﻿<navigation:Page x:Class="Corina.Lantern.Hub.Home"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:localViewmodel="clr-namespace:Corina.Lantern.Hub.Viewmodels"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                 xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
                 xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
                 Style="{StaticResource PageStyle}"
                 d:DesignHeight="480"
                 d:DesignWidth="960"
                 mc:Ignorable="d">
    <navigation:Page.DataContext>
        <localViewmodel:HomeViewmodel />
    </navigation:Page.DataContext>

    <Grid x:Name="LayoutRoot">
        <ScrollViewer x:Name="PageScrollViewer"
                      HorizontalScrollBarVisibility="Disabled"
                      Style="{StaticResource PageScrollViewerStyle}">

            <StackPanel x:Name="ContentStackPanel">

                <StackPanel Margin="0,12" Orientation="Horizontal">
                    <Path Width="48"
                          Height="48"
                          Margin="0,0,0,0"
                          Data="M26.144002,22.314948C26.144002,22.314948,37.124986,24.929934,38.169999,35.386948L0,35.386948C0,35.386948,3.1390064,23.883915,12.55099,22.838019L15.100001,33.752917 16.972986,33.737903 19.103998,28.150021 17.114984,24.702029 21.088004,24.702029 19.184991,28.237912 21.614005,33.699939 23.073997,33.687976z M18.821006,0C24.639007,0 29.358007,4.7180004 29.358007,10.537002 29.358007,16.355002 24.639007,21.073002 18.821006,21.073002 13.002006,21.073002 8.2850049,16.355002 8.2850049,10.537002 8.2850049,4.7180004 13.002006,0 18.821006,0z"
                          Fill="{StaticResource ControlBackgroundNormalOrange}"
                          RenderTransformOrigin="0.5,0.5"
                          Stretch="Uniform">
                        <Path.RenderTransform>
                            <TransformGroup>
                                <TransformGroup.Children>
                                    <RotateTransform Angle="0" />
                                    <ScaleTransform ScaleX="1" ScaleY="1" />
                                </TransformGroup.Children>
                            </TransformGroup>
                        </Path.RenderTransform>
                    </Path>

                    <StackPanel Margin="12,0">
                        <TextBlock>
                            <Run Text="尊敬的" />
                            <Run Text="{Binding UserName}" />
                            <Run Text="，" />
                            <Run Text="{Binding Greetings}" />
                            <Run Text="！欢迎使用泊银科技安全检测信息管理系统。" />
                        </TextBlock>
                        <StackPanel Margin="0,12,0,0" Orientation="Horizontal">

                            <TextBlock Margin="0,0,24,0">
                                <Run Text="您的注册时间为：" />
                                <Run Text="{Binding RegisterTime, StringFormat=\{0:F\}}" />
                            </TextBlock>

                            <HyperlinkButton Content="帐号设置" />
                        </StackPanel>

                    </StackPanel>


                </StackPanel>

                <StackPanel Margin="0,12" Orientation="Horizontal">
                    <Path Width="48"
                          Height="48"
                          Margin="0,0,0,0"
                          Data="M51.380001,32.068995L57.516998,32.068995 57.516998,34.205996 51.380001,34.205996z M46.343998,17.240995L34.391994,32.732965 34.392021,32.733496C34.392021,33.209833,34.271416,33.657843,34.059044,34.048716L34.027981,34.099829 40.27599,45.104986 31.444658,35.482542 31.349895,35.477762C29.958689,35.336584 28.87499,34.162504 28.87499,32.733496 28.87499,31.305424 29.958689,30.131401 31.349895,29.990227L31.631977,29.975996z M31.448,6.0759869L31.330723,6.0774708C17.319036,6.4324751 6.0689697,17.902769 6.0689697,32.000002 6.0689697,32.440477 6.0799561,32.878397 6.1016703,33.31349L6.1380005,33.895815 6.1380005,32.068995 12.276,32.068995 12.276,34.205996 6.1634102,34.205996 6.1987343,34.610064C7.4860158,47.485987,18.194767,57.590624,31.330723,57.923525L31.448,57.925009 31.448,51.861994 33.584999,51.861994 33.584999,57.88236 33.995102,57.856363C47.383911,56.837332 57.930969,45.647802 57.930969,32.000002 57.930969,18.3503 47.383911,7.1633954 33.995102,6.1446152L33.584999,6.1186256 33.584999,12.069994 31.448,12.069994z M32,0C49.671997,-4.802082E-07 64,14.326997 64,32.000002 64,49.670996 49.671997,63.998999 32,63.998999 14.326965,63.998999 0,49.670996 0,32.000002 0,14.326997 14.326965,-4.802082E-07 32,0z"
                          Fill="{StaticResource ControlBackgroundNormalGreen}"
                          RenderTransformOrigin="0.5,0.5"
                          Stretch="Uniform">
                        <Path.RenderTransform>
                            <TransformGroup>
                                <TransformGroup.Children>
                                    <RotateTransform Angle="0" />
                                    <ScaleTransform ScaleX="1" ScaleY="1" />
                                </TransformGroup.Children>
                            </TransformGroup>
                        </Path.RenderTransform>
                    </Path>

                    <StackPanel Margin="12,0">
                        <TextBlock>
                            <Run Text="您上次登录时间为：" />
                            <Run Text="{Binding LastLogin, StringFormat=\{0:F\}}" />
                        </TextBlock>
                        <StackPanel Margin="0,12,0,0" Orientation="Horizontal">

                            <TextBlock Margin="0,0,24,0">
                                <Run Text="不是您登录的？" />
                            </TextBlock>

                            <HyperlinkButton Content="点击这里" />
                            <TextBlock Text="与管理员联系" />
                        </StackPanel>

                    </StackPanel>
                </StackPanel>

                <Rectangle Style="{StaticResource BreakLineStyle}" Margin="0,12"/>

                <StackPanel Margin="0,12">
                    <TextBlock Text="您有以下设备服务即将到期：" />
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="300" />
                        </Grid.ColumnDefinitions>
                        <sdk:DataGrid AutoGenerateColumns="False"
                                      ColumnWidth="*"
                                      IsReadOnly="True"
                                      ItemsSource="{Binding ExpireDeviceCollection}">
                            <sdk:DataGrid.Columns>
                                <sdk:DataGridTextColumn Binding="{Binding DeviceSn}" Header="设备序列号" />
                                <sdk:DataGridTextColumn Binding="{Binding StartTime}" Header="起始时间" />
                                <sdk:DataGridTextColumn Binding="{Binding ExpireTime}" Header="到期时间" />
                                <sdk:DataGridTemplateColumn Header="剩余天数">
                                    <sdk:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Grid>
                                                <TextBlock Foreground="Red"
                                                           Text="{Binding Remaind}"
                                                           Visibility="{Binding Remaind,
                                                                                Converter={StaticResource SmallerThanToVisibilityConverter},
                                                                                ConverterParameter=0}" />
                                                <TextBlock Foreground="{StaticResource COLOR_BLUE}"
                                                           Text="{Binding Remaind}"
                                                           Visibility="{Binding Remaind,
                                                                                Converter={StaticResource GreaterThanToVisibilityConverter},
                                                                                ConverterParameter=0}" />
                                            </Grid>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellTemplate>
                                </sdk:DataGridTemplateColumn>
                                <sdk:DataGridTemplateColumn Header="当前状态">
                                    <sdk:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Grid>
                                                <TextBlock Foreground="Red"
                                                           Text="已过期"
                                                           Visibility="{Binding Remaind,
                                                                                Converter={StaticResource SmallerThanToVisibilityConverter},
                                                                                ConverterParameter=0}" />
                                                <TextBlock Foreground="{StaticResource COLOR_BLUE}"
                                                           Text="即将过期"
                                                           Visibility="{Binding Remaind,
                                                                                Converter={StaticResource GreaterThanToVisibilityConverter},
                                                                                ConverterParameter=0}" />
                                            </Grid>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellTemplate>
                                </sdk:DataGridTemplateColumn>
                            </sdk:DataGrid.Columns>
                        </sdk:DataGrid>

                        <StackPanel Grid.Column="1" Margin="24,0,0,0">
                            <TextBlock TextWrapping="Wrap">
                                <Run Text="为保证设备的正常使用，请及时联系客服续期！" />
                                <LineBreak />
                                <Run Text="客服电话：" />
                                <Run FontSize="24"
                                     Foreground="OrangeRed"
                                     Text="400-600-8017" />
                            </TextBlock>
                            <Button Style="{StaticResource GreenButton}" Content="续费 >>" Margin="0,12,0,0" Padding="12" HorizontalAlignment="Left"/>
                        </StackPanel>
                    </Grid>
                </StackPanel>

                <Rectangle Margin="0,12" Style="{StaticResource BreakLineStyle}" />

                <StackPanel Margin="0,12" Orientation="Horizontal">
                    <StackPanel Margin="12,0">
                        <Path Width="48"
                              Height="48"
                              Margin="0,6"
                              Data="{Binding Converter={StaticResource StringToPathGeometryConverter},
                                             Source={StaticResource ICON_DEVICE}}"
                              Fill="{StaticResource ControlBackgroundPressedGreen}"
                              RenderTransformOrigin="0.5,0.5"
                              Stretch="Uniform">
                            <Path.RenderTransform>
                                <TransformGroup>
                                    <TransformGroup.Children>
                                        <RotateTransform Angle="0" />
                                        <ScaleTransform ScaleX="1" ScaleY="1" />
                                    </TransformGroup.Children>
                                </TransformGroup>
                            </Path.RenderTransform>
                        </Path>
                        <TextBlock Text="设备管理" />
                    </StackPanel>

                    <StackPanel Margin="12,0">
                        <Path Width="48"
                              Height="48"
                              Margin="0,6"
                              Data="{Binding Converter={StaticResource StringToPathGeometryConverter},
                                             Source={StaticResource ICON_DATABASE}}"
                              Fill="{StaticResource ControlBackgroundPressedGreen}"
                              RenderTransformOrigin="0.5,0.5"
                              Stretch="Uniform">
                            <Path.RenderTransform>
                                <TransformGroup>
                                    <TransformGroup.Children>
                                        <RotateTransform Angle="0" />
                                        <ScaleTransform ScaleX="1" ScaleY="1" />
                                    </TransformGroup.Children>
                                </TransformGroup>
                            </Path.RenderTransform>
                        </Path>
                        <TextBlock Text="设备管理" />
                    </StackPanel>

                    <StackPanel Margin="12,0">
                        <Path Width="48"
                              Height="48"
                              Margin="0,6"
                              Data="{Binding Converter={StaticResource StringToPathGeometryConverter},
                                             Source={StaticResource ICON_STOCK}}"
                              Fill="{StaticResource ControlBackgroundPressedGreen}"
                              RenderTransformOrigin="0.5,0.5"
                              Stretch="Uniform">
                            <Path.RenderTransform>
                                <TransformGroup>
                                    <TransformGroup.Children>
                                        <RotateTransform Angle="0" />
                                        <ScaleTransform ScaleX="1" ScaleY="1" />
                                    </TransformGroup.Children>
                                </TransformGroup>
                            </Path.RenderTransform>
                        </Path>
                        <TextBlock Text="设备管理" />
                    </StackPanel>
                </StackPanel>
                
                

            </StackPanel>

        </ScrollViewer>
    </Grid>

</navigation:Page>